import { observable, action, autorun, toJS } from 'mobx';
import { WeaTableNew, WeaForm } from 'comsMobx';

const { TableStore } = WeaTableNew;
import { ListStore } from './listStore';
import { WeaTools } from 'ecCom';
import * as Apis from '../apis/birthday';
import { WeaLocaleProvider } from 'ecCom';

const getLabel = WeaLocaleProvider.getLabel;
export class BirthdayStore extends ListStore {
	@observable title = '';
	@observable rightMenu =[];
	// conditiontype = {conditiontype:"execute"};
	@action
    initDatas=(params = {}) => {
      this.title = getLabel(22743, '客户生日');
      Apis.getBirthdayCondition(params).then((data) => {
        this.condition = data.datas;
        // 根据高级搜索条件初始化form
        this.form && !this.form.isFormInit && this.form.initFormFields(data.datas);
      });
    }

	@action
    doSearch=(params = {}) => {
      this.loading = true;
		 // 获取表单的参数值
		 const searchParamsAd = this.form.getFormParams();
		 const newParams = { ...searchParamsAd, ...params };
      Apis.getBirthdayList(newParams).then((data) => {
        this.tableStore.getDatas(data.sessionkey, params.current || 1);
        this.dataKey = data.sessionkey;
        this.loading = false;
      });
    }


	onShowColumn=() => { // 显示定制列
	  this.tableStore.setColSetVisible(true);
	  this.tableStore.tableColSet(true);
	}


	clearStatus=() => {
	  this.showSearchAd = false;
	  this.resetForm();
	}
}

